//
//  AddDeviceVc.m
//  QoilPublic
//
//  Created by SunChao on 2018/4/19.
//  Copyright © 2018年 孙超. All rights reserved.
//

#import "AddDeviceVC.h"

#import "TagViewCell.h"
@interface AddDeviceVC ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UITableView *tbView;
@property (nonatomic,strong)NSArray *dataArray;
@property (nonatomic, strong) NSMutableDictionary *heightAtIndexPath;//缓存高度所用字典
@end

@implementation AddDeviceVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"新增设备";
    
    self.tbView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];
    
    
    [self.tbView registerNib:[UINib nibWithNibName:@"BokenListCell" bundle:nil] forCellReuseIdentifier:@"BokenListCell"];
    
    
    [self.view addSubview:self.tbView];
    [self.tbView registerClass:[TagViewCell class] forCellReuseIdentifier:NSStringFromClass(TagViewCell.class)];

     _dataArray =  @[@"kekenken",@"keken",@"knenenenk",@"kekeen",@"keken",@"knenenenkenkasdasd",@"ke",@"keken",@"knenenenkk",@"kekenken",@"ken0",@"knenenkenk",@"keken",@"kekenasdsadasd",@"knenenkk",@"kekenken",@"keken",@"knenenkenk",@"kekenken",@"keken",@"knenenkenk"];
 
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    TagViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(TagViewCell.class)];
    
    [cell setTextArray:_dataArray row:indexPath.section];
    
    return cell;
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
   
    return 1;
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    
    return 1;
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return [TagViewCell cellHeightTextArray:_dataArray Row:indexPath.section];
}

-(UITableView *)tbView{
    
    if (!_tbView) {
        _tbView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight) style:UITableViewStylePlain];
        _tbView.delegate = self;
        _tbView.dataSource = self;
        _tbView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    }
    return _tbView;
    
}

@end
